package com.itheima.Thraed.ThreadPrinciple;

public class demo04 {
    static int r = 0;
    public static void main(String[] args) throws InterruptedException {
        test1();
    }

    private static void test1() throws InterruptedException {
        System.out.println("开始");
        Thread t1 = new Thread(() -> {
            System.out.println("开始");
            try {
                Thread.sleep(1);
                System.out.println("结束");
                r = 10;
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        t1.start();
        // 等待某个线程结束
        t1.join();
        System.out.println(r);

    }
}
